﻿
<div class="stock_search">
    <ul>
        <li>
            <input name="txt_code" id="txt_code" type="text" class="stock_search_input" value="" size="" />
        </li>
        <li>
            <input name="" id="soCode" class="stock_search_bt" type="button" />
        </li>
    </ul>
         
        <script type='text/javascript' src='http://zlb.emoney.cn/js/jquery.autocomplete.pack.js'></script>
        <script type='text/javascript' src='http://zlb.emoney.cn/js/StockSearchData.js'></script>
        <link rel="stylesheet" type="text/css" href="http://zlb.emoney.cn/css/jquery.autocomplete.css" />
        <script type="text/javascript">
            $(document).ready(function () {

                $("#txt_code").autocomplete(EALists, {
                    max: 8,
                    minChars: 0,
                    width: 205,
                    matchContains: true,
                    autoFill: false,
                    formatItem: function (row, i, max) {
                        return row._C + " " + row._S + " " + row._N;
                    },
                    formatMatch: function (row, i, max) {
                        return row._C + " " + row._S + " " + row._N;
                    },
                    formatResult: function (row) {

                        return row._C;
                    }
                });

                $("#txt_code").submit(function () {
                    var reg = /^\d{6}$/;
                    if (reg.test($("#txt_code").val())) {
                        document.location.href = 'http://stock.emoney.cn/gg' + $("#txt_code").val() + ".shtml";
                    }
                    else {
                        alert("请输入正确的股票代码！");
                    }
                    return false;
                });
                $("#soCode").click(function () {
                    var reg = /^\d{6}$/;
                    if (reg.test($("#txt_code").val())) {
                        document.location.href = 'http://stock.emoney.cn/gg' + $("#txt_code").val() + ".shtml";
                    }
                    else {
                        alert("请输入正确的股票代码！");
                    }
                });
                return false;
            })
        </script>
    </div>